<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>

  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">






  
  
    
      
    
    
      
    
  <script async src="//cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
  <link href="//cdn.jsdelivr.net/npm/pace-js@1.0.2/themes/blue/pace-theme-minimal.css" rel="stylesheet">








<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />


















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />


<link href="https://fonts.loli.net/css?family=EB+Garamond:400,400i,700,700i|Noto+Serif+SC:400,500,700&display=swap&subset=chinese-simplified" rel="stylesheet">




  

<link href="//cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Android,BugFree," />





  <link rel="alternate" href="/blog/atom.xml" title="叶金诚的站点" type="application/atom+xml" />






<meta name="description" content="MTK log介绍mtklog是由log生成工具MTKLogger生成的一系列问题追踪文件，其主要作用就是对系统或者应用产生的异常进行快速定位，从而解决问题。 log文件名称为：crash_log ：崩溃日志，主要输出 程序崩溃造成的crash logevents_log：事件日志，主要输出记录各个activity周期及事件kernel_log：底层驱动，按键，低内存相关logsys_log：系统">
<meta property="og:type" content="article">
<meta property="og:title" content="mtk-log">
<meta property="og:url" content="http://idolcoder.gitee.io/blog/2021/02/mtk-log/index.html">
<meta property="og:site_name" content="叶金诚的站点">
<meta property="og:description" content="MTK log介绍mtklog是由log生成工具MTKLogger生成的一系列问题追踪文件，其主要作用就是对系统或者应用产生的异常进行快速定位，从而解决问题。 log文件名称为：crash_log ：崩溃日志，主要输出 程序崩溃造成的crash logevents_log：事件日志，主要输出记录各个activity周期及事件kernel_log：底层驱动，按键，低内存相关logsys_log：系统">
<meta property="og:locale">
<meta property="og:image" content="http://cdn.yangchaofan.cn/blog/20210227/br8ouvYv45G7.jpg?imageslim">
<meta property="og:image" content="http://cdn.yangchaofan.cn/blog/20210227/DiGViDp5mmch.png?imageslim">
<meta property="og:image" content="http://cdn.yangchaofan.cn/blog/20210227/qgVnqzd6p6IJ.png?imageslim">
<meta property="og:image" content="http://cdn.yangchaofan.cn/blog/20210227/nwDUjynnBdXh.png?imageslim">
<meta property="og:image" content="http://cdn.yangchaofan.cn/blog/20210227/VRnI24X9QxKP.png?imageslim">
<meta property="og:image" content="http://cdn.yangchaofan.cn/blog/20210227/POXrsi3L2V0k.png?imageslim">
<meta property="og:image" content="http://cdn.yangchaofan.cn/blog/20210227/59zvGw73P6Qr.png?imageslim">
<meta property="og:image" content="http://cdn.yangchaofan.cn/blog/20210227/Qm2wlH7QktoL.png?imageslim">
<meta property="og:image" content="http://cdn.yangchaofan.cn/blog/20210227/Xchbq9MizBGV.png?imageslim">
<meta property="article:published_time" content="2021-02-27T01:13:12.000Z">
<meta property="article:modified_time" content="2021-04-02T12:50:08.517Z">
<meta property="article:author" content="叶金诚">
<meta property="article:tag" content="Android">
<meta property="article:tag" content="BugFree">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://cdn.yangchaofan.cn/blog/20210227/br8ouvYv45G7.jpg?imageslim">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":true,"onmobile":true},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":true,"transition":{"post_block":"flipBounceYIn","post_header":"perspectiveRightIn","post_body":"fadeIn","coll_header":"swoopIn","sidebar":"shrinkIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://idolcoder.gitee.io/blog/2021/02/mtk-log/"/>





<!-- 设置文章需要密码访问 -->
<script>
    (function(){
        if(''){
            if (prompt('请输入文章密码') !== ''){
                alert('密码错误！');
                history.back();
            }
        }
    })();
</script>

  <title>mtk-log | 叶金诚的站点</title>
  









  

  
	<!-- leafacePlayer -->
	
      <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
      <meta name="baidu-site-verification" content="code-lde50FghqK" />

	

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <!--fork me from github-->
    <a target="_blank" rel="noopener" href="https://github.com/ShaunSheep" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#64CEAA; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">叶金诚的站点</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description">汇贤雅叙</h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/blog/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-movies">
          <a href="/blog/movies/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-film"></i> <br />
            
            电影
          </a>
        </li>
      
        
        <li class="menu-item menu-item-图书">
          <a href="/blog/books/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-calendar"></i> <br />
            
            图书
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-links">
          <a href="/blog/links/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-link"></i> <br />
            
            友链
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/blog/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>


 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://idolcoder.gitee.io/blog/blog/2021/02/mtk-log/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/blog/images/head.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="叶金诚的站点">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">mtk-log</h2>
        

        <div class="post-meta">
          <span class="post-time">

             

             

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2021-02-27T09:13:12+08:00">
                2021-02-27
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/Android/" itemprop="url" rel="index">
                    <span itemprop="name">Android</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/Android/BugFree/" itemprop="url" rel="index">
                    <span itemprop="name">BugFree</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/Android/%E9%9D%A2%E8%AF%95/" itemprop="url" rel="index">
                    <span itemprop="name">面试</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          
             <span id="/blog/2021/02/mtk-log/" class="leancloud_visitors" data-flag-title="mtk-log">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">浏览&#58;</span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          <!--
          
          -->

          
            <span class="post-wordcount">
              
                
                  <span class="post-meta-divider">|</span>
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数&#58;</span>
                
                <span title="字数">
                  2.6k
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">时长 &asymp;</span>
                
                <span title="时长">
                  11 分钟
                </span>
              
            </span>
          

          <!-- 隐藏文章内标题下，内容描述
          
          -->

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/hint.css/2.4.1/hint.min.css"><h1 id="mtk-log"><a href="#MTK-log" class="headerlink" title="MTK log"></a><a target="_blank" rel="noopener" href="https://www.pianshen.com/article/4121163154/">MTK log</a><a href="#mtk-log" class="header-anchor">#</a></h1><h2 id="介绍"><a href="#介绍" class="headerlink" title="介绍"></a>介绍<a href="#介绍" class="header-anchor">#</a></h2><p>mtklog是由log生成工具MTKLogger生成的一系列问题追踪文件，其主要作用就是对系统或者应用产生的异常进行快速定位，从而解决问题。</p>
<p>log文件名称为：<br>crash_log ：崩溃日志，主要输出 程序崩溃造成的crash log<br>events_log：事件日志，主要输出记录各个activity周期及事件<br>kernel_log：底层驱动，按键，低内存相关log<br>sys_log：系统日志，Exception定位点<br>radio_log：输出通话，网络状态变化<br>main_log：详尽输出每一步的log</p>
<a id="more"></a>

<h2 id="开启和关闭"><a href="#开启和关闭" class="headerlink" title="开启和关闭"></a>开启和关闭<a href="#开启和关闭" class="header-anchor">#</a></h2><p>（1）在拨号盘界面输入*#9646633# ：<br>（2）进入EngineerMode的第一个Telephony界面：<br>（3）向左滑动进入Log and Debugging界面：<br>（4）点击MTKLogger 菜单：点击log设置图标可进入log设置界面，如果我只要打印MobileLog可将ModemLog，NetworkLog，GPSlog关闭，点击蓝底色1 即可：<br>（5）点击开始（红色播放按键）按键：<br>（6）log 开启：<br>（7）当我们已经发现异常时，当关闭log，并截图记录时间点，下拉进入下拉栏界面，点击MTKLogger is running：<br>（8）点击停止按键</p>
<h2 id="log总览"><a href="#Log总览" class="headerlink" title="Log总览**"></a>Log总览**<a href="#log总览" class="header-anchor">#</a></h2><ul>
<li><strong>Android Log</strong></li>
</ul>
<ol>
<li>Android java层和native层 log</li>
<li>main log、system log、radio log、event log</li>
</ol>
<ul>
<li><strong>Kernel Log</strong></li>
</ul>
<ol>
<li>Linux Kernel内核和驱动log</li>
<li>UART Log</li>
</ol>
<ul>
<li><strong>Exception Datebase(db)</strong></li>
</ul>
<p>系统死机/重启等问题发生时候的原始RAW data</p>
<h2 id="log-tools"><a href="#Log-Tools" class="headerlink" title="Log Tools"></a><strong>Log Tools</strong><a href="#log-tools" class="header-anchor">#</a></h2><ul>
<li>mtklogger</li>
<li>PC tool</li>
</ul>
<p><img src="http://cdn.yangchaofan.cn/blog/20210227/br8ouvYv45G7.jpg?imageslim" alt="mark"></p>
<h3 id="手机端mtklogger"><a href="#手机端mtklogger" class="headerlink" title="手机端mtklogger"></a><strong>手机端mtklogger</strong><a href="#手机端mtklogger" class="header-anchor">#</a></h3><p><img src="http://cdn.yangchaofan.cn/blog/20210227/DiGViDp5mmch.png?imageslim" alt="mark"></p>
<p><img src="http://cdn.yangchaofan.cn/blog/20210227/qgVnqzd6p6IJ.png?imageslim" alt="mark"></p>
<h4 id="个人优化"><a href="#个人优化" class="headerlink" title="个人优化"></a><strong>个人优化</strong><a href="#个人优化" class="header-anchor">#</a></h4><h5 id="mtklog抓取完整kernel-log"><a href="#mtklog抓取完整kernel-log" class="headerlink" title="mtklog抓取完整kernel log"></a><strong>mtklog抓取完整kernel log</strong><a href="#mtklog抓取完整kernel-log" class="header-anchor">#</a></h5><ul>
<li><strong>默认抓不全原因</strong></li>
</ul>
<p>由于Mobilelog service运行要在android system init阶段，而从kernel启动到这个阶段，kernel log已经在不断地送入log ring buffer，log量大的情况下ring buffer就会被覆盖</p>
<p>默认抓取到的kernel_log.boot不是从0s开始，对于研发debug阶段,只能靠抓取uart log来获取0s开始的log，非常影响debug效率</p>
<ul>
<li><strong>解决方法</strong></li>
</ul>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="PLAIN"><figure class="iseeu highlight /plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">alps&#x2F;kernel-3.18&#x2F;init&#x2F;Kconfig</span><br><span class="line">config LOG_BUF_SHIFT</span><br><span class="line">       default 17  --- &gt; 21   2^21&#x3D;2MB buffer</span><br><span class="line"></span><br><span class="line">alps&#x2F;system&#x2F;core&#x2F;liblog&#x2F;include&#x2F;private&#x2F;android_logger.h</span><br><span class="line">#define LOG_BUFFER_SIZE (2048 * 1024)    #log和logd一致</span><br><span class="line">123456</span><br></pre></td></tr></table></figure></div>
<h3 id="电脑端pc-tool"><a href="#电脑端PC-tool" class="headerlink" title="电脑端PC tool"></a><strong>电脑端PC tool</strong><a href="#电脑端pc-tool" class="header-anchor">#</a></h3><h4 id="adb"><a href="#adb" class="headerlink" title="adb"></a><strong>adb</strong><a href="#adb" class="header-anchor">#</a></h4><h5 id="logcat"><a href="#logcat" class="headerlink" title="logcat"></a><strong>logcat</strong><a href="#logcat" class="header-anchor">#</a></h5><ul>
<li><strong>介绍</strong></li>
</ul>
<p>logcat是android中的一个命令行工具，可以用于得到程序的log信息</p>
<p>常见的日志纪录方法包括：</p>
<table>
<thead>
<tr>
<th align="left">方法</th>
<th align="left">描述</th>
</tr>
</thead>
<tbody><tr>
<td align="left">v(String,String) (vervbose)</td>
<td align="left">显示全部信息</td>
</tr>
<tr>
<td align="left">d(String,String)(debug)</td>
<td align="left">显示调试信息</td>
</tr>
<tr>
<td align="left">i(String,String)(information)</td>
<td align="left">显示一般信息</td>
</tr>
<tr>
<td align="left">w(String,String)(waning)</td>
<td align="left">显示警告信息</td>
</tr>
<tr>
<td align="left">e(String,String)(error)</td>
<td align="left">显示错误信息</td>
</tr>
</tbody></table>
<p>例如：</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="PLAIN"><figure class="iseeu highlight /plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">&#x2F;&#x2F;开发过程中获取log</span><br><span class="line">Log.i(&quot;MyActivity&quot;,&quot;MyClass.getView() - get item number&quot;+position);</span><br><span class="line">&#x2F;&#x2F;adb获取log</span><br><span class="line">adb logcat</span><br><span class="line">1234</span><br></pre></td></tr></table></figure></div>
<p>adb logcat输出的日志格式如下：</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="PLAIN"><figure class="iseeu highlight /plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">I&#x2F;ActivityManager( 1754): Waited long enough for: ServiceRecord&#123;2b24178c u0 com.google.android.gms&#x2F;.checkin.CheckinService&#125;</span><br></pre></td></tr></table></figure></div>
<ul>
<li><strong>实例</strong></li>
</ul>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="SHELL"><figure class="iseeu highlight /shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">adb logcat –b radio</span><br><span class="line">adb logcat –b system</span><br><span class="line">adb logcat –b events</span><br><span class="line">adb logcat –b main</span><br><span class="line">1234</span><br></pre></td></tr></table></figure></div>
<ul>
<li><strong>优势</strong></li>
</ul>
<ol>
<li>缓冲区强大，不会因为数据量过大而丢失log</li>
<li>过滤性能好</li>
<li>语法简洁，使用方便</li>
</ol>
<h5 id="提取db"><a href="#提取db" class="headerlink" title="提取db"></a><strong>提取db</strong><a href="#提取db" class="header-anchor">#</a></h5><ul>
<li><strong>位置</strong></li>
</ul>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="PLAIN"><figure class="iseeu highlight /plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&#x2F;data&#x2F;aee_exp</span><br><span class="line">&#x2F;data&#x2F;vendor&#x2F;mtklog&#x2F;aee_exp</span><br><span class="line">12</span><br></pre></td></tr></table></figure></div>
<h4 id="gat"><a href="#GAT" class="headerlink" title="GAT"></a><strong>GAT</strong><a href="#gat" class="header-anchor">#</a></h4><p><img src="http://cdn.yangchaofan.cn/blog/20210227/nwDUjynnBdXh.png?imageslim" alt="mark"></p>
<ul>
<li><strong>BugReport</strong></li>
</ul>
<p><img src="http://cdn.yangchaofan.cn/blog/20210227/VRnI24X9QxKP.png?imageslim" alt="mark"></p>
<ul>
<li><strong>DB puller</strong></li>
</ul>
<p><img src="http://cdn.yangchaofan.cn/blog/20210227/POXrsi3L2V0k.png?imageslim" alt="mark"></p>
<ul>
<li><strong>Mediatek LogView</strong></li>
</ul>
<p><img src="http://cdn.yangchaofan.cn/blog/20210227/59zvGw73P6Qr.png?imageslim" alt="mark"></p>
<h2 id="各种mode抓mobile-log"><a href="#各种mode抓mobile-log" class="headerlink" title="各种mode抓mobile log"></a><strong>各种mode抓mobile log</strong><a href="#各种mode抓mobile-log" class="header-anchor">#</a></h2><h3 id="normal-mode"><a href="#Normal-mode" class="headerlink" title="Normal mode"></a><strong>Normal mode</strong><a href="#normal-mode" class="header-anchor">#</a></h3><ol>
<li>GAT (user版本只能抓main log，eng版本还能抓到kernel log)</li>
<li>mtklogger(user版本通过*#<em>#3646633#</em>#*进入工模选择)，会暂时录制到/data/log_temp下，等SD卡ready后再copy到mtklog/mobilelog/APLog路径下</li>
</ol>
<h3 id="meta-modepc-meta-tool"><a href="#Meta-mode-PC-meta-tool" class="headerlink" title="Meta mode(PC meta tool)"></a><strong>Meta mode(PC meta tool)</strong><a href="#meta-modepc-meta-tool" class="header-anchor">#</a></h3><ul>
<li>会先录制到/data/log_temp/meta/下，等外卡ready后再copy到sdcard1/mtklog/mobilelog/APLog路径下，然后删除源文件(data/log_temp)。</li>
</ul>
<h3 id="factory-modepower-down-key"><a href="#Factory-mode-power-down-key" class="headerlink" title="Factory mode(power + down key)"></a><strong>Factory mode(power + down key)</strong><a href="#factory-modepower-down-key" class="header-anchor">#</a></h3><ul>
<li>同Meta mode</li>
</ul>
<h3 id="recovery-modepower-up-key"><a href="#Recovery-mode-power-up-key" class="headerlink" title="Recovery mode(power + up key)"></a><strong>Recovery mode(power + up key)</strong><a href="#recovery-modepower-up-key" class="header-anchor">#</a></h3><ol>
<li>先存在tmp/recovery.log，Reboot进入normal后存在cache/recovery</li>
<li>user 版本需要下载eng的recovery.img和boot.img才能抓log</li>
</ol>
<h3 id="ipo-mode"><a href="#IPO-mode" class="headerlink" title="IPO mode"></a><strong>IPO mode</strong><a href="#ipo-mode" class="header-anchor">#</a></h3><ol>
<li>设置IPO关机后，关机期间的log会录制到/data/log_temp/ipo/下，等再次开机后再copy到/mtklog/mobilelog/APLog路径下，然后删除源文件。</li>
<li>GAT</li>
</ol>
<h2 id="各种场景抓log"><a href="#各种场景抓log" class="headerlink" title="各种场景抓log"></a><strong>各种场景抓log</strong><a href="#各种场景抓log" class="header-anchor">#</a></h2><h3 id="preloader-amp-lk阶段没有logo或卡在logo界面开机log"><a href="#Preloader-amp-LK阶段（没有logo或卡在logo界面）开机log" class="headerlink" title="Preloader &amp; LK阶段（没有logo或卡在logo界面）开机log"></a><strong>Preloader &amp; LK阶段（没有logo或卡在logo界面）开机log</strong><a href="#preloader-amp-lk阶段没有logo或卡在logo界面开机log" class="header-anchor">#</a></h3><ul>
<li>抓取uart log</li>
</ul>
<h3 id="kernel阶段有logo或开机动画开机log"><a href="#Kernel阶段（有logo或开机动画-开机log" class="headerlink" title="Kernel阶段（有logo或开机动画)开机log"></a>Kernel阶段（有logo或开机动画)开机log<a href="#kernel阶段有logo或开机动画开机log" class="header-anchor">#</a></h3><ol>
<li>如果是User版本，先用对应ENG 版本的lk 替换掉user 版本的lk</li>
<li>或者在user load的<code>alps/bootable/bootloader/lk/app/mt_boot/mt_boot.c</code>中，将所有<code>printk.disable_uart=1</code>改成<code>printk.disable_uart=0</code>，然后重新编译lk, download lk 即可。</li>
</ol>
<h3 id="android阶段有开机动画开机log"><a href="#Android阶段（有开机动画）开机log" class="headerlink" title="Android阶段（有开机动画）开机log"></a><strong>Android阶段（有开机动画）开机log</strong><a href="#android阶段有开机动画开机log" class="header-anchor">#</a></h3><p>Adbd进程起来后，可以使用GAT抓取开机log（录制前先关机）。</p>
<p>若mtklogger可用，可以通过设置mobile log开机自启动录制开机log。</p>
<p>停止录制状态下mtklogger-&gt;settings-&gt;mobile log-&gt;start automticaly</p>
<p>若TP无法使用，可以参考FAQ06939使用adb命令控制mtklogger录制。</p>
<h3 id="user-build-抓开机向导或者不开机log"><a href="#user-build-抓开机向导或者不开机log" class="headerlink" title="user build 抓开机向导或者不开机log"></a><strong>user build 抓开机向导或者不开机log</strong><a href="#user-build-抓开机向导或者不开机log" class="header-anchor">#</a></h3><p>编译一版eng版本对应软件，做如下修改：</p>
<p><a target="_blank" rel="noopener" href="https://ad.plus/?utm_source=pianshen.com&utm_medium=protag-in_article_video&utm_campaign=brand_logo">Powered by <strong>Ad.Plus</strong></a></p>
<p><video class="pa_video pa_size_640_360" playsinline muted width="640" height="360" style="box-sizing: border-box; display: inline-block; vertical-align: baseline; overflow: hidden; max-width: 100%; height: 225px; transition: height 0s ease-out 0s; width: 400px;"></video></p>
<iframe src="https://imasdk.googleapis.com/js/core/bridge3.444.1_zh.html#goog_420327109" allowfullscreen allow="autoplay" width="640" height="360" style="box-sizing: border-box; height: 225px !important; width: 400px !important; border: 0px; opacity: 1; margin: 0px; padding: 0px; position: relative; color-scheme: light;"></iframe>



<ol>
<li><code>alps/system/core/rootdir/init.rc</code></li>
</ol>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="R"><figure class="iseeu highlight /r"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">on property:ro.debuggable=<span class="number">1</span></span><br><span class="line">    <span class="comment"># Give writes to anyone for the trace folder on debug builds.</span></span><br><span class="line">    <span class="comment"># The folder is used to store method traces.</span></span><br><span class="line">    chmod <span class="number">0773</span> /data/misc/trace</span><br><span class="line">    start console</span><br><span class="line">//add begin</span><br><span class="line">on property:ro.debuggable=<span class="number">0</span></span><br><span class="line">    <span class="comment"># Give writes to anyone for the trace folder on debug builds.</span></span><br><span class="line">    <span class="comment"># The folder is used to store method traces.</span></span><br><span class="line">    chmod <span class="number">0773</span> /data/misc/trace</span><br><span class="line">    start console</span><br><span class="line">setprop persist.sys.usb.config mass_storage,adb //add end</span><br><span class="line">123456789101112</span><br></pre></td></tr></table></figure></div>
<ol>
<li><code>alps/kernel-3.18/drivers/misc/mediatek/mtprof/bootprof.c</code></li>
</ol>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="CPP"><figure class="iseeu highlight /cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">ifdef</span> CONFIG_MT_PRINTK_UART_CONSOLE</span></span><br><span class="line">    <span class="comment">//mt_disable_uart();</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">endif</span></span></span><br><span class="line"><span class="number">123</span></span><br></pre></td></tr></table></figure></div>
<ol>
<li><code>alps/build/make/core/main.mk</code></li>
</ol>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="MAKEFILE"><figure class="iseeu highlight /makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ifeq</span> (true,<span class="variable">$(<span class="built_in">strip</span> <span class="variable">$(enable_target_debugging)</span>)</span>)  <span class="comment"># Target is more debuggable and adbd is on by default</span></span><br><span class="line">  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1  <span class="comment"># Enable Dalvik lock contention logging.</span></span><br><span class="line">  ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500   <span class="comment"># Include the debugging/testing OTA keys in this build.</span></span><br><span class="line">  INCLUDE_TEST_OTA_KEYS := true</span><br><span class="line"><span class="keyword">else</span> <span class="comment"># !enable_target_debugging</span></span><br><span class="line">  <span class="comment"># Target is less debuggable and adbd is off by default</span></span><br><span class="line">  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1</span><br><span class="line"><span class="keyword">endif</span> <span class="comment"># !enable_target_debugging</span></span><br><span class="line">12345678</span><br></pre></td></tr></table></figure></div>
<p>编译好后，user版本刷入eng版本的lk+boot， 抓取uart 或者上层log</p>
<p>如需抓取开机向导前的log，由于系统还未正式起来，请焊uart线，uart log中输入<code>adb logcat &amp;</code>将上层log输出到uart log中</p>
<h2 id="aee异常机制"><a href="#AEE异常机制" class="headerlink" title="AEE异常机制"></a><strong>AEE异常机制</strong><a href="#aee异常机制" class="header-anchor">#</a></h2><h3 id="aee介绍"><a href="#AEE介绍" class="headerlink" title="AEE介绍"></a><strong>AEE介绍</strong><a href="#aee介绍" class="header-anchor">#</a></h3><p><code>AEE (Android Exception Engine)</code>是安卓的一个异常捕获和调试信息生成机制。</p>
<p>手机发生错误（异常重启/卡死）时生成db文件（一种被加密过的二进制文件）</p>
<h3 id="why-do-we-need-aee"><a href="#why-do-we-need-AEE" class="headerlink" title="why do we need AEE"></a><strong>why do we need AEE</strong><a href="#why-do-we-need-aee" class="header-anchor">#</a></h3><p>用来保存和记录异常发生时候的所有内存信息，通过调试和仿真这些信息，可以追踪到异常的原因</p>
<h3 id="db文件介绍"><a href="#DB文件介绍" class="headerlink" title="DB文件介绍"></a><strong>DB文件介绍</strong><a href="#db文件介绍" class="header-anchor">#</a></h3><table>
<thead>
<tr>
<th align="left"><strong>File</strong></th>
<th align="left"><strong>Description</strong></th>
</tr>
</thead>
<tbody><tr>
<td align="left"><strong>__exp_main.txt</strong></td>
<td align="left">异常类型，调用栈等关键信息</td>
</tr>
<tr>
<td align="left">_exp_detail.txt</td>
<td align="left">详细异常信息</td>
</tr>
<tr>
<td align="left"><strong>SYS_ANDROID_LOG</strong></td>
<td align="left">android buffer log(logcat -d -v time *:v)</td>
</tr>
<tr>
<td align="left"><strong>SYS_KERNEL_LOG</strong></td>
<td align="left">kernel log</td>
</tr>
<tr>
<td align="left"><strong>SYS_LAST_KMSG</strong></td>
<td align="left">上次重启前的kernel log</td>
</tr>
<tr>
<td align="left"><strong>SYS_MINI_RDUMP</strong></td>
<td align="left">类似coredump，可以用gdb/trace32调试</td>
</tr>
<tr>
<td align="left">SYS_WDT_LOG</td>
<td align="left">看门狗复位信息</td>
</tr>
<tr>
<td align="left">SYS_REBOOT_REASON</td>
<td align="left">重启时的硬件记录的信息</td>
</tr>
<tr>
<td align="left">SYS_VERSION_INFO</td>
<td align="left">kernel版本，用于和vmlinux对比，只有匹配的vmlinux才能用于分析这个异常</td>
</tr>
<tr>
<td align="left">SYS_ANDROID_EVENT_LOG</td>
<td align="left">android event log(logcat -b events -v time -d *:v)</td>
</tr>
<tr>
<td align="left">SYS_ANDROID_RADIO_LOG</td>
<td align="left">android buffer log(logcat -b radio -v time -d *:v)</td>
</tr>
<tr>
<td align="left"><strong>PROCESS_COREDUMP</strong></td>
<td align="left">native program core dump</td>
</tr>
<tr>
<td align="left"><strong>SYS_PROPERTIES</strong></td>
<td align="left">system properties</td>
</tr>
<tr>
<td align="left">SWT_JBT_TRACES</td>
<td align="left">/data/anr/.</td>
</tr>
<tr>
<td align="left">ZZ_INTERNAL</td>
<td align="left">基本异常信息</td>
</tr>
<tr>
<td align="left">SYS_CPU_INFO</td>
<td align="left">cpu 信息(top -n 1 -d 1 -m 30 -t)</td>
</tr>
<tr>
<td align="left">SYS_MEMORY_INFO</td>
<td align="left">memory information (/proc/meminfo)</td>
</tr>
</tbody></table>
<ul>
<li><strong>重启原因记录</strong></li>
</ul>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="CPP"><figure class="iseeu highlight /cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">struct</span> <span class="title">last_reboot_reason</span></span></span><br><span class="line"><span class="class">&#123;</span></span><br><span class="line">    <span class="keyword">uint32_t</span> fiq_step;</span><br><span class="line">    <span class="keyword">uint32_t</span> exp_type; <span class="comment">/* 0xaeedeadX: X=1 (HWT), X=2 (KE), X=3 (nested panic) */</span></span><br><span class="line">    <span class="keyword">uint32_t</span> reboot_mode;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">uint32_t</span> last_irq_enter[NR_CPUS];</span><br><span class="line">    <span class="keyword">uint64_t</span> jiffies_last_irq_enter[NR_CPUS];</span><br><span class="line"></span><br><span class="line">    <span class="keyword">uint32_t</span> last_irq_exit[NR_CPUS];</span><br><span class="line">    <span class="keyword">uint64_t</span> jiffies_last_irq_exit[NR_CPUS];</span><br><span class="line"></span><br><span class="line">    <span class="keyword">uint64_t</span> jiffies_last_sched[NR_CPUS];</span><br><span class="line">    <span class="keyword">char</span> last_sched_comm[NR_CPUS][TASK_COMM_LEN];</span><br><span class="line"></span><br><span class="line">    <span class="keyword">uint8_t</span> hotplug_data1[NR_CPUS], <span class="keyword">uint8_t</span> hotplug_data2;</span><br><span class="line">    <span class="keyword">uint64_t</span> hotplug_data3;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">uint32_t</span> mcdi_wfi, mcdi_r15, deepidle_data, sodi_data, spm_suspend_data;</span><br><span class="line">    <span class="keyword">uint64_t</span> cpu_dormant[NR_CPUS];</span><br><span class="line">    <span class="keyword">uint32_t</span> clk_data[<span class="number">8</span>], suspend_debug_flag;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">uint8_t</span> cpu_dvfs_vproc_big, cpu_dvfs_vproc_little, cpu_dvfs_oppidx, cpu_dvfs_status;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">uint8_t</span> gpu_dvfs_vgpu, gpu_dvfs_oppidx, gpu_dvfs_status;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">uint64_t</span> ptp_cpu_big_volt, ptp_cpu_little_volt, ptp_gpu_volt, ptp_temp;</span><br><span class="line">    <span class="keyword">uint8_t</span> ptp_status;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">uint8_t</span> thermal_temp1, thermal_temp2, thermal_temp3, thermal_temp4, thermal_temp5;</span><br><span class="line">    <span class="keyword">uint8_t</span> thermal_status;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">void</span> *kparams;</span><br><span class="line">&#125;;</span><br><span class="line"><span class="number">12345678910111213141516171819202122232425262728293031323334</span></span><br></pre></td></tr></table></figure></div>
<h2 id="实际应用总结"><a href="#实际应用总结" class="headerlink" title="实际应用总结"></a><strong>实际应用总结</strong><a href="#实际应用总结" class="header-anchor">#</a></h2><h3 id="usr状态不同现象手机如何抓取有效log"><a href="#usr状态，不同现象手机如何抓取有效log" class="headerlink" title="usr状态，不同现象手机如何抓取有效log"></a><strong>usr状态，不同现象手机如何抓取有效log</strong><a href="#usr状态不同现象手机如何抓取有效log" class="header-anchor">#</a></h3><ol>
<li>可正常开机</li>
</ol>
<p>A：MTKlogger基本足矣</p>
<ol>
<li>卡logo，不开机</li>
</ol>
<p>A：</p>
<ul>
<li>刷入eng的lk和boot，再跳线抓取uart log，并开启logcat抓取从开机到异常出现时的所有底层和上层log</li>
<li>如果偶尔可以开机，第一时间进入系统提取db信息</li>
<li>如上述方式无法提取到关键db，则需要通过flashtool来回读db的原始raw分区，再通过自制expdb解压工具展开</li>
</ul>
<h3 id="debug阶段手机如何抓取有效log"><a href="#debug阶段，手机如何抓取有效log" class="headerlink" title="debug阶段，手机如何抓取有效log"></a><strong>debug阶段，手机如何抓取有效log</strong><a href="#debug阶段手机如何抓取有效log" class="header-anchor">#</a></h3><ol>
<li>无ctp情况下如何调试手机</li>
</ol>
<p>A：连接adb，通过adb发送ctp报点与手势，来操作手机</p>
<ol>
<li>无lcd情况下如何调试手机</li>
</ol>
<p>A：使用GAT工具，实时抓取手机内部frame buffer，投影到电脑上，并用adb命令操作手机</p>
<ol>
<li>UART Log量太大，无法找出重要log怎么办</li>
</ol>
<p>A：采用adb logcat方式实时过滤带关键字关键level的log （包括kernel log）</p>
<h3 id="log分析与调试技巧"><a href="#Log分析与调试技巧" class="headerlink" title="Log分析与调试技巧"></a><strong>Log分析与调试技巧</strong><a href="#log分析与调试技巧" class="header-anchor">#</a></h3><h4 id="android开机流程图"><a href="#Android开机流程图" class="headerlink" title="Android开机流程图"></a><strong>Android开机流程图</strong><a href="#android开机流程图" class="header-anchor">#</a></h4><p><img src="http://cdn.yangchaofan.cn/blog/20210227/Qm2wlH7QktoL.png?imageslim" alt="mark"></p>
<h4 id="bootprof"><a href="#bootprof" class="headerlink" title="bootprof"></a><strong>bootprof</strong><a href="#bootprof" class="header-anchor">#</a></h4><div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="PLAIN"><figure class="iseeu highlight /plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">adb shell cat &#x2F;proc&#x2F;bootprof or mktlog bootprof file</span><br></pre></td></tr></table></figure></div>
<p><img src="http://cdn.yangchaofan.cn/blog/20210227/Xchbq9MizBGV.png?imageslim" alt="mark"></p>
<h4 id="实际案例不开机类"><a href="#实际案例（不开机类）" class="headerlink" title="实际案例（不开机类）"></a><strong>实际案例（不开机类）</strong><a href="#实际案例不开机类" class="header-anchor">#</a></h4><h5 id="文件系统损坏导致挂载失败"><a href="#文件系统损坏导致挂载失败" class="headerlink" title="文件系统损坏导致挂载失败"></a><strong>文件系统损坏导致挂载失败</strong><a href="#文件系统损坏导致挂载失败" class="header-anchor">#</a></h5><p>System mount fail 导致 service 起不来，readback system分区对比看是否文件破坏。</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="PLAIN"><figure class="iseeu highlight /plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">[138:kworker&#x2F;u16:2]device-mapper: verity: 179:30: metadata block 716579 is corrupted</span><br><span class="line">[246:init]JBD2: IO error reading journal superblock</span><br><span class="line">[246:init]EXT4-fs (dm-0): error loading journal</span><br><span class="line">[246:init]fs_mgr: __mount(source&#x3D;&#x2F;dev&#x2F;block&#x2F;dm-0,target&#x3D;&#x2F;system,type&#x3D;ext4)&#x3D;-1  &lt;&lt;&#x3D;&#x3D;&#x3D;文件系统挂载失败</span><br><span class="line">[246:init]EXT4-fs (mmcblk0p31): VFS: Can&#39;t find ext4 filesystem</span><br><span class="line">12345</span><br></pre></td></tr></table></figure></div>
<p>经常遇到无法开机的问题，低概率、难复现，而且软、硬体跨度大，不易掌握与追踪；</p>
<p>事后分析:</p>
<p>部分有硬件实际损坏、系统映像档被破坏，或用户拔电池导致系统核心文件损坏…等几种原因。其中一部分导致无法开机的问题是由于不当操作使得文件损坏导致的。</p>
<p>PS:产线也会报小概率不开机的问题。</p>
<p>Donwload完整性检查和开机检查客制化</p>
<p>检查kernel log是否有<strong>emmc i/o error</strong>相关log</p>
<p>如果是单机问题检查emmc相关供电或作替换物料交叉实验</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="PLAIN"><figure class="iseeu highlight /plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">[ 5.030802] &lt;0&gt;.(0)[165:mmcqd&#x2F;0]mmcblk0: error -110 transferring data, sector 5448262, nr 442, cmd</span><br><span class="line">response 0x900, card status 0x0</span><br><span class="line">[ 5.032358] &lt;0&gt;.(0)[165:mmcqd&#x2F;0]blk_update_request: I&#x2F;O error, dev mmcblk0, sector 5448262</span><br><span class="line">[ 5.130190] &lt;0&gt;.(0)[179:init]EXT4-fs (dm-0): unable to read superblock</span><br><span class="line">[ 5.131325] &lt;0&gt;.(0)[179:init]fs_mgr: __mount(source&#x3D;&#x2F;dev&#x2F;block&#x2F;dm-0,target&#x3D;&#x2F;system,type&#x3D;ext4)&#x3D;-1  &lt;&lt;&#x3D;&#x3D;&#x3D;文件系统挂载失败</span><br><span class="line">12345</span><br></pre></td></tr></table></figure></div>
<h5 id="preloader-hang-by-mem-test-fail"><a href="#preloader-hang-by-mem-test-fail" class="headerlink" title="preloader hang by mem test fail"></a><strong>preloader hang by mem test fail</strong><a href="#preloader-hang-by-mem-test-fail" class="header-anchor">#</a></h5><div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="PLAIN"><figure class="iseeu highlight /plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">[50:31:154] [MEM] complex R&#x2F;W mem test fail :FFFFFFFF</span><br><span class="line">[50:31:155] &lt;ASSERT&gt; memory.c:line 105 0</span><br><span class="line">[50:31:155] PL fatal error</span><br><span class="line">[50:31:155] PL delay for Long Press Reboot</span><br><span class="line">[50:31:159] power key is pressed</span><br><span class="line">[50:36:117] [PLF]Emergency Dwld mode(timeout: 5s)</span><br><span class="line">[50:36:119] mtk_arch_reset at pre-loader!</span><br><span class="line">1234567</span><br></pre></td></tr></table></figure></div>
<ul>
<li><strong>场景追溯</strong></li>
</ul>
<ol>
<li>此问题发生的背景，是产线样机？研发样机？还是客退机？</li>
<li>问题发生概率如何？有固定的复现路径吗？目前遇到的问题是在什么测试下发生的？</li>
<li>问题发生是在一台机器，还是多台机器都有遇到？—- 如果是单机问题该memory硬件问题可能性大</li>
<li>用料是否为MTK QVL上已经验证OK的？其他项目上是否已经使用过？</li>
</ol>
<link rel="stylesheet" href="/css/bilicard.css" type="text/css">

        

      
    </div>

      <!-- 相关文章推荐 -->
     
          

  <div class="popular-posts-header">
    <i class="fa fa-graduation-cap"></i>
    相关文章
  </div>

 <details>
   <summary>点击查看</summary>
     <ul class="popular-posts">
     
       <li class="popular-posts-item">
         
         
         <div class="popular-posts-title"><a href="\blog\2021\05\The-most-comprehensive-thinking-of-crash-practice-strategy\" rel="bookmark">Android Crash实践策略最全面思考</a></div>
         
       </li>
     
       <li class="popular-posts-item">
         
         
         <div class="popular-posts-title"><a href="\blog\2021\05\android-crash-who-kill-you\" rel="bookmark">Android Crash揭秘与实践</a></div>
         
       </li>
     
       <li class="popular-posts-item">
         
         
         <div class="popular-posts-title"><a href="\blog\2021\02\android-bugfree-three-lines\" rel="bookmark">BugFree三剑客异常、日志、工具</a></div>
         
       </li>
     
       <li class="popular-posts-item">
         
         
         <div class="popular-posts-title"><a href="\blog\2021\02\Client-Skeleton-Screen\" rel="bookmark">Android骨架屏详解</a></div>
         
       </li>
     
       <li class="popular-posts-item">
         
         
         <div class="popular-posts-title"><a href="\blog\2021\01\Android-plug-in-technology-selection\" rel="bookmark">Android插件化技术选型</a></div>
         
       </li>
     
       <li class="popular-posts-item">
         
         
         <div class="popular-posts-title"><a href="\blog\2021\01\Android-component-Practice-Guide\" rel="bookmark">Android组件化实践指南</a></div>
         
       </li>
     
       <li class="popular-posts-item">
         
         
         <div class="popular-posts-title"><a href="\blog\2021\01\android-structure-best-practice\" rel="bookmark">Android大厂架构设计最佳实践</a></div>
         
       </li>
     
       <li class="popular-posts-item">
         
         
         <div class="popular-posts-title"><a href="\blog\2020\08\handler TOP 100 Questions\" rel="bookmark">AndroidHandler百问百答</a></div>
         
       </li>
     
       <li class="popular-posts-item">
         
         
         <div class="popular-posts-title"><a href="\blog\2018\02\MVC-MVP-MVVM -of -architecture -selection\" rel="bookmark">架构选型之MVC、MVP、MVVM</a></div>
         
       </li>
     
       <li class="popular-posts-item">
         
         
         <div class="popular-posts-title"><a href="\blog\2016\06\android-communication\" rel="bookmark">详解 Android 通信</a></div>
         
       </li>
     
     </ul>
 </details>



     

    
    
    

    <div>
          
            

          
    </div>

    

    <div>
      
        <div>
    
        <div class="read-over">-------------------本文结束 <i class="fa fa-paw"></i> 感谢您的阅读-------------------</div>
    
</div>

      
    </div>

    
      <div>
        <div class="share_reward">
  <div>坚持原创技术分享，感谢您的支持和鼓励！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="http://cdn.yangchaofan.cn/BlogGifRes/20210313/s7mteFUqc8pH.png" alt=" 微信支付"/>
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="http://cdn.yangchaofan.cn/BlogGifRes/20210313/oQnokBcx6RUO.png" alt=" 支付宝"/>
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    
      <div>
        <ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者：</strong>
    叶金诚
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://idolcoder.gitee.io/blog/2021/02/mtk-log/" title="mtk-log">http://idolcoder.gitee.io/blog/2021/02/mtk-log/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>
    本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-nd/3.0/deed.zh" rel="external nofollow" target="_blank">Creative Commons BY-NC-ND 3.0</a> 许可协议。转载请注明出处！
  </li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/blog/tags/Android/" rel="tag"> <i class="fa fa-tag"></i> Android</a>
          
            <a href="/blog/tags/BugFree/" rel="tag"> <i class="fa fa-tag"></i> BugFree</a>
          
        </div>
      

      
      
        <div class="post-widgets">
        

        

        
          
          <div id="needsharebutton-postbottom">
            <span class="btn">
              <i class="fa fa-share-alt" aria-hidden="true"></i>
            </span>
          </div>
        
        </div>
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2021/04/Career-stability-experience/" rel="prev" title="职业稳定性杂谈">
                <i class="fa fa-chevron-left"></i> 职业稳定性杂谈
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2021/02/android-bugfree-three-lines/" rel="next" title="BugFree三剑客异常、日志、工具">
                BugFree三剑客异常、日志、工具 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
        
  <script>
    window._bd_share_config = {
      "common": {
        "bdText": "",
        "bdMini": "1",
        "bdMiniList": false,
        "bdPic": ""
      },
      "image": {
        "viewList": ["tsina", "douban", "sqq", "qzone", "weixin", "twi", "fbook"],
        "viewText": "分享到：",
        "viewSize": "16"
      },
      "slide": {
        "bdImg": "5",
        "bdPos": "left",
        "bdTop": "100"
      }
    }
  </script>

<script>
//  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
//    with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="lv-container" data-id="city" data-uid="MTAyMC81Mjc2OC8yOTI0NQ"></div>
    </div>

  





        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
      <div id="sidebar-dimmer"></div>
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <a href="/">
              <img class="site-author-image" itemprop="image"
                src="/blog/images/head.png"
                alt="" />
              </a>
            
              <p class="site-author-name" itemprop="name"></p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives/">
              
                  <span class="site-state-item-count">24</span>
                  <span class="site-state-item-name">文章</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/blog/categories/index.html">
                  <span class="site-state-item-count">16</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/blog/tags/index.html">
                  <span class="site-state-item-count">14</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/blog/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
              <!-- 为Hexo Next主题添加哈林摇特效  -->
              <a title="收藏到书签，偶尔High一下^_^" rel="alternate" class="mw-harlem_shake_slow wobble shake" href="javascript:void(0)" onclick="javascript:(function go() {function c() {var e = document.createElement('link');e.setAttribute('type', 'text/css');e.setAttribute('rel', 'stylesheet');e.setAttribute('href', f);e.setAttribute('class', l);document.body.appendChild(e)}function h(){var e = document.getElementsByClassName(l);for(var t = 0; t< e.length; t++){document.body.removeChild(e[t])}}function p(){var e = document.createElement('div');e.setAttribute('class', a);document.body.appendChild(e);setTimeout(function(){document.body.removeChild(e)},100)}function d(e){return{height:e.offsetHeight,width:e.offsetWidth}}function v(i){var s = d(i);return s.height>e &amp;&amp;s.height<n &amp;&amp; s.width>t &amp;&amp;s.width<r}function m(e){var t=e;var n=0;while(!!t){n+=t.offsetTop;t=t.offsetParent}return n}function g(){var e=document.documentElement;if(!!window.innerWidth){return window.innerHeight}else if(e &amp;&amp; !isNaN(e.clientHeight)){return e.clientHeight}return 0}function y(){if(window.pageYOffset){return window.pageYOffset}return Math.max(document.documentElement.scrollTop,document.body.scrollTop)}function E(e){var t=m(e);return t>=w &amp;&amp; t<=b+w}var songs=['https://www.liaofuzhan.com/music/无尽光芒.mp3'];function S(){var e=document.getElementById('audio_element_id');if(e!=null){var index=parseInt(e.getAttribute('curSongIndex'));if(index>songs.length-2){index=0;}else{index++;}e.setAttribute('curSongIndex',index);N();}e.src=i;e.play()}function x(e){e.className+=' '+s+' '+o}function T(e){e.className+=' '+s+' '+u[Math.floor(Math.random()*u.length)]}function N(){var e=document.getElementsByClassName(s);var t=new RegExp('\\b'+s+'\\b');for(var n=0;n<e.length;){e[n].className=e[n].className.replace(t,'')}}function initAudioEle(){var e=document.getElementById('audio_element_id');if(e===null){e=document.createElement('audio');e.setAttribute('class',l);e.setAttribute('curSongIndex',0);e.id='audio_element_id';e.loop=false;e.bgcolor=0;e.addEventListener('canplay',function(){setTimeout(function(){x(k)},500);setTimeout(function(){N();p();for(var e=0;e<O.length;e++){T(O[e])}},15500)},true);e.addEventListener('ended',function(){N();h();go();},true);e.innerHTML='<p>If you are reading this,it is because your browser does not support the audio element. We recommend that you get a new browser.</p><p>';document.body.appendChild(e);}}initAudioEle();var e=30;var t=30;var n=350;var r=350;var curSongIndex=parseInt(document.getElementById('audio_element_id').getAttribute('curSongIndex'));var i=songs[curSongIndex];var s='mw-harlem_shake_me';var o='im_first';var u=['im_drunk','im_baked','im_trippin','im_blown'];var a='mw-strobe_light';var f='https://s3.amazonaws.com/moovweb-marketing/playground/harlem-shake-style.css';var l='mw_added_css';var b=g();var w=y();var C=document.getElementsByTagName('*');var k=null;for(var L=0;L<C.length;L++){var A=C[L];if(v(A)){if(E(A)){k=A;break}}}if(A===null){console.warn('Could not find a node of the right size. Please try a different page.');return}c();S();var O=[];for(var L=0;L<C.length;L++){var A=C[L];if(v(A)){O.push(A)}}})()"><i class="fa fa-music"></i> High~</a>

            </div>
          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a rel="external nofollow" href="https://github.com/ShaunSheep" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a rel="external nofollow" href="mailto:zuogewoniu@qq.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a rel="external nofollow" href="https://www.douban.com/people/jincheng-ycf/" target="_blank" title="豆瓣">
                      
                        <i class="fa fa-fw fa-stack-overflow"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a rel="external nofollow" href="https://www.zhihu.com/people/OscarWildeHawking" target="_blank" title="知乎">
                      
                        <i class="fa fa-fw fa-instagram"></i></a>
                  </span>
                
            </div>
          

            <!--
            <div id="music163player">
                <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=1336790004&auto=1&height=66"></iframe>
            </div>
            -->

          
          

          
          

          <!--近期文章版块 began-->
          
              <div class="links-of-blogroll motion-element links-of-blogroll-block">
                <div class="links-of-blogroll-title">
                  <i class="fa fa-history fa-" aria-hidden="true"></i>
                  近期文章
                </div>
                <ul class="links-of-blogroll-list">
                  
                  
                    <li class='my-links-of-blogroll-li'>
                      <a href="/blog/2021/05/The-most-comprehensive-thinking-of-crash-practice-strategy/" title="Android Crash实践策略最全面思考" target="_blank">Android Crash实践策略最全面思考</a>
                    </li>
                  
                    <li class='my-links-of-blogroll-li'>
                      <a href="/blog/2021/05/android-crash-who-kill-you/" title="Android Crash揭秘与实践" target="_blank">Android Crash揭秘与实践</a>
                    </li>
                  
                    <li class='my-links-of-blogroll-li'>
                      <a href="/blog/2021/04/Career-stability-experience/" title="职业稳定性杂谈" target="_blank">职业稳定性杂谈</a>
                    </li>
                  
                    <li class='my-links-of-blogroll-li'>
                      <a href="/blog/2021/02/mtk-log/" title="mtk-log" target="_blank">mtk-log</a>
                    </li>
                  
                    <li class='my-links-of-blogroll-li'>
                      <a href="/blog/2021/02/android-bugfree-three-lines/" title="BugFree三剑客异常、日志、工具" target="_blank">BugFree三剑客异常、日志、工具</a>
                    </li>
                  
                </ul>
              </div>
          
          <!--近期文章版块 end-->

          
              <!-- canvas粒子时钟 -->
              <!-- canvas粒子时钟 https://www.cnblogs.com/xiaohuochai/p/6368039.html
  https://www.html5tricks.com/html5-canvas-dance-time.html
 -->
<div id="">
  <canvas id="canvas" style="width:60%;">
</div>
<script async>
(function(){
  var WINDOW_WIDTH = 820;
  		var WINDOW_HEIGHT = 250;
  		var RADIUS = 7; //球半径
  		var NUMBER_GAP = 10; //数字之间的间隙
  		var u=0.65; //碰撞能量损耗系数
  		var context; //Canvas绘制上下文
  		var balls = []; //存储彩色的小球
  		const colors = ["#33B5E5","#0099CC","#AA66CC","#9933CC","#99CC00","#669900","#FFBB33","#FF8800","#FF4444","#CC0000"]; //彩色小球的颜色
  		var currentNums = []; //屏幕显示的8个字符
  		var digit =
                  [
                      [
                          [0,0,1,1,1,0,0],
                          [0,1,1,0,1,1,0],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [0,1,1,0,1,1,0],
                          [0,0,1,1,1,0,0]
                      ],//0
                      [
                          [0,0,0,1,1,0,0],
                          [0,1,1,1,1,0,0],
                          [0,0,0,1,1,0,0],
                          [0,0,0,1,1,0,0],
                          [0,0,0,1,1,0,0],
                          [0,0,0,1,1,0,0],
                          [0,0,0,1,1,0,0],
                          [0,0,0,1,1,0,0],
                          [0,0,0,1,1,0,0],
                          [1,1,1,1,1,1,1]
                      ],//1
                      [
                          [0,1,1,1,1,1,0],
                          [1,1,0,0,0,1,1],
                          [0,0,0,0,0,1,1],
                          [0,0,0,0,1,1,0],
                          [0,0,0,1,1,0,0],
                          [0,0,1,1,0,0,0],
                          [0,1,1,0,0,0,0],
                          [1,1,0,0,0,0,0],
                          [1,1,0,0,0,1,1],
                          [1,1,1,1,1,1,1]
                      ],//2
                      [
                          [1,1,1,1,1,1,1],
                          [0,0,0,0,0,1,1],
                          [0,0,0,0,1,1,0],
                          [0,0,0,1,1,0,0],
                          [0,0,1,1,1,0,0],
                          [0,0,0,0,1,1,0],
                          [0,0,0,0,0,1,1],
                          [0,0,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [0,1,1,1,1,1,0]
                      ],//3
                      [
                          [0,0,0,0,1,1,0],
                          [0,0,0,1,1,1,0],
                          [0,0,1,1,1,1,0],
                          [0,1,1,0,1,1,0],
                          [1,1,0,0,1,1,0],
                          [1,1,1,1,1,1,1],
                          [0,0,0,0,1,1,0],
                          [0,0,0,0,1,1,0],
                          [0,0,0,0,1,1,0],
                          [0,0,0,1,1,1,1]
                      ],//4
                      [
                          [1,1,1,1,1,1,1],
                          [1,1,0,0,0,0,0],
                          [1,1,0,0,0,0,0],
                          [1,1,1,1,1,1,0],
                          [0,0,0,0,0,1,1],
                          [0,0,0,0,0,1,1],
                          [0,0,0,0,0,1,1],
                          [0,0,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [0,1,1,1,1,1,0]
                      ],//5
                      [
                          [0,0,0,0,1,1,0],
                          [0,0,1,1,0,0,0],
                          [0,1,1,0,0,0,0],
                          [1,1,0,0,0,0,0],
                          [1,1,0,1,1,1,0],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [0,1,1,1,1,1,0]
                      ],//6
                      [
                          [1,1,1,1,1,1,1],
                          [1,1,0,0,0,1,1],
                          [0,0,0,0,1,1,0],
                          [0,0,0,0,1,1,0],
                          [0,0,0,1,1,0,0],
                          [0,0,0,1,1,0,0],
                          [0,0,1,1,0,0,0],
                          [0,0,1,1,0,0,0],
                          [0,0,1,1,0,0,0],
                          [0,0,1,1,0,0,0]
                      ],//7
                      [
                          [0,1,1,1,1,1,0],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [0,1,1,1,1,1,0],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [0,1,1,1,1,1,0]
                      ],//8
                      [
                          [0,1,1,1,1,1,0],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [1,1,0,0,0,1,1],
                          [0,1,1,1,0,1,1],
                          [0,0,0,0,0,1,1],
                          [0,0,0,0,0,1,1],
                          [0,0,0,0,1,1,0],
                          [0,0,0,1,1,0,0],
                          [0,1,1,0,0,0,0]
                      ],//9
                      [
                          [0,0,0,0],
                          [0,0,0,0],
                          [0,1,1,0],
                          [0,1,1,0],
                          [0,0,0,0],
                          [0,0,0,0],
                          [0,1,1,0],
                          [0,1,1,0],
                          [0,0,0,0],
                          [0,0,0,0]
                      ]//:
                  ];

  		function drawDatetime(cxt){
  			var nums = [];

  			context.fillStyle="#005eac"
  			var date = new Date();
  			var offsetX = 70, offsetY = 30;
  			var hours = date.getHours();
  			var num1 = Math.floor(hours/10);
  			var num2 = hours%10;
  			nums.push({num: num1});
  			nums.push({num: num2});
  			nums.push({num: 10}); //冒号
  			var minutes = date.getMinutes();
  			var num1 = Math.floor(minutes/10);
  			var num2 = minutes%10;
  			nums.push({num: num1});
  			nums.push({num: num2});
  			nums.push({num: 10}); //冒号
  			var seconds = date.getSeconds();
  			var num1 = Math.floor(seconds/10);
  			var num2 = seconds%10;
  			nums.push({num: num1});
  			nums.push({num: num2});

  			for(var x = 0;x<nums.length;x++){
  				nums[x].offsetX = offsetX;
  				offsetX = drawSingleNumber(offsetX,offsetY, nums[x].num,cxt);
  				//两个数字连一块，应该间隔一些距离
  				if(x<nums.length-1){
  					if((nums[x].num!=10) &&(nums[x+1].num!=10)){
  						offsetX+=NUMBER_GAP;
  					}
  				}
  			}

  			//说明这是初始化
  			if(currentNums.length ==0){
  				currentNums = nums;
  			}else{
  				//进行比较
  				for(var index = 0;index<currentNums.length;index++){
  					if(currentNums[index].num!=nums[index].num){
  						//不一样时，添加彩色小球
  						addBalls(nums[index]);
  						currentNums[index].num=nums[index].num;
  					}
  				}
  			}
  			renderBalls(cxt);
  			updateBalls();

  			return date;
  		}

  		function addBalls (item) {
  			var num = item.num;
  			var numMatrix = digit[num];
  			for(var y = 0;y<numMatrix.length;y++){
  				for(var x = 0;x<numMatrix[y].length;x++){
  					if(numMatrix[y][x]==1){
  						var ball={
  							offsetX:item.offsetX+RADIUS+RADIUS*2*x,
  							offsetY:30+RADIUS+RADIUS*2*y,
  							color:colors[Math.floor(Math.random()*colors.length)],
  							g:1.5+Math.random(),
  							vx:Math.pow(-1, Math.ceil(Math.random()*10))*4+Math.random(),
  							vy:-5
  						}
  						balls.push(ball);
  					}
  				}
  			}
  		}

  		function renderBalls(cxt){
  			for(var index = 0;index<balls.length;index++){
  				cxt.beginPath();
  				cxt.fillStyle=balls[index].color;
  				cxt.arc(balls[index].offsetX, balls[index].offsetY, RADIUS, 0, 2*Math.PI);
  				cxt.fill();
  			}
  		}

  		function updateBalls () {
  			var i =0;
  			for(var index = 0;index<balls.length;index++){
  				var ball = balls[index];
  				ball.offsetX += ball.vx;
  				ball.offsetY += ball.vy;
  				ball.vy+=ball.g;
  				if(ball.offsetY > (WINDOW_HEIGHT-RADIUS)){
  					ball.offsetY= WINDOW_HEIGHT-RADIUS;
  					ball.vy=-ball.vy*u;
  				}
  				if(ball.offsetX>RADIUS&&ball.offsetX<(WINDOW_WIDTH-RADIUS)){

  					balls[i]=balls[index];
  					i++;
  				}
  			}
  			//去除出边界的球
  			for(;i<balls.length;i++){
  				balls.pop();
  			}
  		}
  		function drawSingleNumber(offsetX, offsetY, num, cxt){
  			var numMatrix = digit[num];
  			for(var y = 0;y<numMatrix.length;y++){
  				for(var x = 0;x<numMatrix[y].length;x++){
  					if(numMatrix[y][x]==1){
  						cxt.beginPath();
  						cxt.arc(offsetX+RADIUS+RADIUS*2*x,offsetY+RADIUS+RADIUS*2*y,RADIUS,0,2*Math.PI);
  						cxt.fill();
  					}
  				}
  			}
  			cxt.beginPath();
  			offsetX += numMatrix[0].length*RADIUS*2;
  			return offsetX;
  		}

  		var canvas = document.getElementById("canvas");
  		canvas.width=WINDOW_WIDTH;
  		canvas.height=WINDOW_HEIGHT;
  		context = canvas.getContext("2d");

  		//记录当前绘制的时刻
  		var currentDate = new Date();

  		setInterval(function(){
  			//清空整个Canvas，重新绘制内容
  			context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  			drawDatetime(context);
  		}, 50)
})();
</script>

          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#mtk-log"><span class="nav-number">1.</span> <span class="nav-text">MTK log</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BB%8B%E7%BB%8D"><span class="nav-number">1.1.</span> <span class="nav-text">介绍</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%BC%80%E5%90%AF%E5%92%8C%E5%85%B3%E9%97%AD"><span class="nav-number">1.2.</span> <span class="nav-text">开启和关闭</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#log%E6%80%BB%E8%A7%88"><span class="nav-number">1.3.</span> <span class="nav-text">Log总览**</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#log-tools"><span class="nav-number">1.4.</span> <span class="nav-text">Log Tools</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%89%8B%E6%9C%BA%E7%AB%AFmtklogger"><span class="nav-number">1.4.1.</span> <span class="nav-text">手机端mtklogger</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E4%B8%AA%E4%BA%BA%E4%BC%98%E5%8C%96"><span class="nav-number">1.4.1.1.</span> <span class="nav-text">个人优化</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#mtklog%E6%8A%93%E5%8F%96%E5%AE%8C%E6%95%B4kernel-log"><span class="nav-number">1.4.1.1.1.</span> <span class="nav-text">mtklog抓取完整kernel log</span></a></li></ol></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%94%B5%E8%84%91%E7%AB%AFpc-tool"><span class="nav-number">1.4.2.</span> <span class="nav-text">电脑端PC tool</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#adb"><span class="nav-number">1.4.2.1.</span> <span class="nav-text">adb</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#logcat"><span class="nav-number">1.4.2.1.1.</span> <span class="nav-text">logcat</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E6%8F%90%E5%8F%96db"><span class="nav-number">1.4.2.1.2.</span> <span class="nav-text">提取db</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#gat"><span class="nav-number">1.4.2.2.</span> <span class="nav-text">GAT</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%90%84%E7%A7%8Dmode%E6%8A%93mobile-log"><span class="nav-number">1.5.</span> <span class="nav-text">各种mode抓mobile log</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#normal-mode"><span class="nav-number">1.5.1.</span> <span class="nav-text">Normal mode</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#meta-modepc-meta-tool"><span class="nav-number">1.5.2.</span> <span class="nav-text">Meta mode(PC meta tool)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#factory-modepower-down-key"><span class="nav-number">1.5.3.</span> <span class="nav-text">Factory mode(power + down key)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#recovery-modepower-up-key"><span class="nav-number">1.5.4.</span> <span class="nav-text">Recovery mode(power + up key)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ipo-mode"><span class="nav-number">1.5.5.</span> <span class="nav-text">IPO mode</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%90%84%E7%A7%8D%E5%9C%BA%E6%99%AF%E6%8A%93log"><span class="nav-number">1.6.</span> <span class="nav-text">各种场景抓log</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#preloader-amp-lk%E9%98%B6%E6%AE%B5%E6%B2%A1%E6%9C%89logo%E6%88%96%E5%8D%A1%E5%9C%A8logo%E7%95%8C%E9%9D%A2%E5%BC%80%E6%9C%BAlog"><span class="nav-number">1.6.1.</span> <span class="nav-text">Preloader &amp; LK阶段（没有logo或卡在logo界面）开机log</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#kernel%E9%98%B6%E6%AE%B5%E6%9C%89logo%E6%88%96%E5%BC%80%E6%9C%BA%E5%8A%A8%E7%94%BB%E5%BC%80%E6%9C%BAlog"><span class="nav-number">1.6.2.</span> <span class="nav-text">Kernel阶段（有logo或开机动画)开机log</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#android%E9%98%B6%E6%AE%B5%E6%9C%89%E5%BC%80%E6%9C%BA%E5%8A%A8%E7%94%BB%E5%BC%80%E6%9C%BAlog"><span class="nav-number">1.6.3.</span> <span class="nav-text">Android阶段（有开机动画）开机log</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#user-build-%E6%8A%93%E5%BC%80%E6%9C%BA%E5%90%91%E5%AF%BC%E6%88%96%E8%80%85%E4%B8%8D%E5%BC%80%E6%9C%BAlog"><span class="nav-number">1.6.4.</span> <span class="nav-text">user build 抓开机向导或者不开机log</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#aee%E5%BC%82%E5%B8%B8%E6%9C%BA%E5%88%B6"><span class="nav-number">1.7.</span> <span class="nav-text">AEE异常机制</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#aee%E4%BB%8B%E7%BB%8D"><span class="nav-number">1.7.1.</span> <span class="nav-text">AEE介绍</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#why-do-we-need-aee"><span class="nav-number">1.7.2.</span> <span class="nav-text">why do we need AEE</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#db%E6%96%87%E4%BB%B6%E4%BB%8B%E7%BB%8D"><span class="nav-number">1.7.3.</span> <span class="nav-text">DB文件介绍</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%9E%E9%99%85%E5%BA%94%E7%94%A8%E6%80%BB%E7%BB%93"><span class="nav-number">1.8.</span> <span class="nav-text">实际应用总结</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#usr%E7%8A%B6%E6%80%81%E4%B8%8D%E5%90%8C%E7%8E%B0%E8%B1%A1%E6%89%8B%E6%9C%BA%E5%A6%82%E4%BD%95%E6%8A%93%E5%8F%96%E6%9C%89%E6%95%88log"><span class="nav-number">1.8.1.</span> <span class="nav-text">usr状态，不同现象手机如何抓取有效log</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#debug%E9%98%B6%E6%AE%B5%E6%89%8B%E6%9C%BA%E5%A6%82%E4%BD%95%E6%8A%93%E5%8F%96%E6%9C%89%E6%95%88log"><span class="nav-number">1.8.2.</span> <span class="nav-text">debug阶段，手机如何抓取有效log</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#log%E5%88%86%E6%9E%90%E4%B8%8E%E8%B0%83%E8%AF%95%E6%8A%80%E5%B7%A7"><span class="nav-number">1.8.3.</span> <span class="nav-text">Log分析与调试技巧</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#android%E5%BC%80%E6%9C%BA%E6%B5%81%E7%A8%8B%E5%9B%BE"><span class="nav-number">1.8.3.1.</span> <span class="nav-text">Android开机流程图</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#bootprof"><span class="nav-number">1.8.3.2.</span> <span class="nav-text">bootprof</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%AE%9E%E9%99%85%E6%A1%88%E4%BE%8B%E4%B8%8D%E5%BC%80%E6%9C%BA%E7%B1%BB"><span class="nav-number">1.8.3.3.</span> <span class="nav-text">实际案例（不开机类）</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E6%8D%9F%E5%9D%8F%E5%AF%BC%E8%87%B4%E6%8C%82%E8%BD%BD%E5%A4%B1%E8%B4%A5"><span class="nav-number">1.8.3.3.1.</span> <span class="nav-text">文件系统损坏导致挂载失败</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#preloader-hang-by-mem-test-fail"><span class="nav-number">1.8.3.3.2.</span> <span class="nav-text">preloader hang by mem test fail</span></a></li></ol></li></ol></li></ol></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

      

      <!-- 标签云 -->
      <!--
      
      <script type="text/javascript" charset="utf-8" src="/js/tagcloud.js"></script>
      <script type="text/javascript" charset="utf-8" src="/js/tagcanvas.js"></script>
      <div class="widget-wrap">
      <h3 class="widget-title">Tag Cloud</h3>
      <div id="myCanvasContainer" class="widget tagcloud">
          <canvas width="250" height="250" id="resCanvas" style="width=100%">
              <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/Android/" rel="tag">Android</a><span class="tag-list-count">13</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/AndroidUI%E4%BC%98%E5%8C%96/" rel="tag">AndroidUI优化</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/Android%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96/" rel="tag">Android性能优化</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/BugFree/" rel="tag">BugFree</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/Communication/" rel="tag">Communication</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/Handler/" rel="tag">Handler</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/Performance/" rel="tag">Performance</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/%E4%B8%AA%E4%BA%BA%E6%95%99%E8%82%B2/" rel="tag">个人教育</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/%E5%AD%A6%E4%B9%A0%E6%96%B9%E6%B3%95/" rel="tag">学习方法</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/%E5%BC%80%E6%BA%90%E6%A1%86%E6%9E%B6/" rel="tag">开源框架</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/%E6%8A%80%E6%9C%AF%E9%80%89%E5%9E%8B/" rel="tag">技术选型</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/%E6%9D%82%E8%B0%88/" rel="tag">杂谈</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/%E7%A8%8B%E5%BA%8F%E4%BA%BA%E7%94%9F%EF%BC%8C%E6%9D%82%E8%B0%88/" rel="tag">程序人生，杂谈</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/%E7%AE%97%E6%B3%95/" rel="tag">算法</a><span class="tag-list-count">1</span></li></ul>
          </canvas>
      </div>
      </div>
      
      -->
      <!-- 标签云 -->

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<div class="copyright">&copy; 2015 &mdash; <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
       <i class="fa fa-heartbeat"></i>
  </span>
  <!--
    <span class="author" itemprop="copyrightHolder"> &nbsp;叶金诚</span>
  -->
  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    
      <span class="post-meta-item-text">Site words total count&#58;</span>
    
    <span title="Site words total count">111k</span>
  
</div>














  <script src='https://unpkg.com/mermaid@7.1.2/dist/mermaid.min.js'></script>
  <script>
    if (window.mermaid) {
      mermaid.initialize("");
    }
  </script>



        
<div class="busuanzi-count">
  <!--
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
  -->
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

   

  
  
    
      <span class="site-uv">
        
        我的第 <span class="busuanzi-value" id="busuanzi_value_site_uv"></span> 位朋友，
      </span>
    

    
      <span class="site-pv">
        历经 <span class="busuanzi-value" id="busuanzi_value_site_pv"></span> 次回眸才与你相遇
        <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      </span>
    
  

</div>








        
      </div>
    </footer>

    
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  










  



  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/npm/jquery@2.1.3/dist/jquery.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/fastclick/1.0.6/fastclick.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/jquery.lazyload/1.9.3/jquery.lazyload.min.js"></script>
  

  
  
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/velocity-animate@1.2.1/velocity.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/npm/velocity-animate@1.2.1/velocity.ui.min.js"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script id="ribbon" type="text/javascript" size="60" alpha="0.1"  zIndex="-1" src="/blog/lib/canvas-ribbon/canvas-ribbon.js"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/blog/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  
    <script type="text/javascript">
      (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
      })(document, 'script');
    </script>
  















  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/blog/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





    <script>  function addCount(Counter){var $visitors=$('.leancloud_visitors');var url=$visitors.attr('id').trim();var title=$visitors.attr('data-flag-title').trim();Counter('get','/classes/Counter',{where:JSON.stringify({url})}).done(function({results}){if(results.length>0){var counter=results[0]; var $element=$(document.getElementById(url));$element.find('.leancloud-visitors-count').text(counter.time+1);Counter('put','/classes/Counter/'+counter.objectId,JSON.stringify({time:{'__op':'Increment','amount':1}})) .fail(function({responseJSON}){console.log('Failed to save Visitor num, with error message: '+responseJSON.error);})}else{ Counter('post','/classes/Counter',JSON.stringify({title:title,url:url,time:1})).done(function(){var $element=$(document.getElementById(url));$element.find('.leancloud-visitors-count').text(1);}).fail(function(){console.log('Failed to create');});}}).fail(function({responseJSON}){console.log('LeanCloud Counter Error: '+responseJSON.code+' '+responseJSON.error);});}$(function(){$.get('https://app-router.leancloud.cn/2/route?appId='+'MFn6psRe8xtnq9sq6lv9MJks-gzGzoHsz').done(function({api_server}){var Counter=function(method,url,data){return $.ajax({method:method,url:'https://'+api_server+'/1.1'+url,headers:{'X-LC-Id':'MFn6psRe8xtnq9sq6lv9MJks-gzGzoHsz','X-LC-Key':'pi8Pa2aH3XpcaovMyqIXVuOP','Content-Type':'application/json',},data:data});};  const localhost=/http:\/\/(localhost|127.0.0.1|0.0.0.0)/;if(localhost.test(document.URL))return;addCount(Counter);});});</script>

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
  
  
  <link rel="stylesheet" href="/blog/lib/needsharebutton/needsharebutton.css">

  
  
  <script src="/blog/lib/needsharebutton/needsharebutton.js"></script>

  <script>
    
      pbOptions = {};
      
          pbOptions.iconStyle = "default";
      
          pbOptions.boxForm = "horizontal";
      
          pbOptions.position = "bottomCenter";
      
          pbOptions.networks = "Weibo,Wechat,Douban,QQZone,Twitter,Facebook";
      
      new needShareButton('#needsharebutton-postbottom', pbOptions);
    
    
  </script>

  

  
  


  

  


  <!-- Tidio 在线联系功能、鼠标点击特效、页面反馈...-->
  <script type="text/javascript" src="/js/src/clipboard.min.js"></script>
<script type="text/javascript" src="/js/src/clipboard-use.js"></script>



  
    <canvas class="fireworks" style="position: fixed;left: 0;top: 0;z-index: 1; pointer-events: none;" ></canvas>
    <script async src="//cdn.bootcss.com/animejs/2.2.0/anime.min.js"></script>
    <script async src="/js/cursor/explosion.min.js"></script>
  










  <script src="/js/src/activate-power-mode.min.js"></script>
  <script>
    POWERMODE.colorful = true;
    POWERMODE.shake = false;
    document.body.addEventListener('input', POWERMODE);
  </script>






  <script async language="javascript">

    var div = document.createElement("div");
    //插入到自定义的theme-info或者copyright之后
    var copyright = document.querySelector(".theme-info2") || document.querySelector(".copyright");

    function show_run_time(){
        window.setTimeout("show_run_time()", 1000);
      // BirthDay=new Date("08/07/2019 20:00:00");
        BirthDay=new Date("08/07/2016 20:00:00");
        today=new Date();
        timeold=(today.getTime()-BirthDay.getTime());
        sectimeold=timeold/1000
        secondsold=Math.floor(sectimeold);
        msPerDay=24*60*60*1000
        e_daysold=timeold/msPerDay
        daysold=Math.floor(e_daysold);
        e_hrsold=(e_daysold-daysold)*24;
        hrsold=setzero(Math.floor(e_hrsold));
        e_minsold=(e_hrsold-hrsold)*60;
        minsold=setzero(Math.floor((e_hrsold-hrsold)*60));
        seconds=setzero(Math.floor((e_minsold-minsold)*60));

        // 使用zh-Hans.yml的文字替换
        div.innerHTML = "我已在此等候你 " + "<span style='color: #1890ff'> " + daysold + " </span> 天 <span style='color: #1890ff'>" + hrsold + " </span>时 <span style='color: #1890ff'>" + minsold + " </span>分 <span style='color: #1890ff'>" + seconds + " </span>秒 ";

        document.querySelector(".footer-inner").insertBefore(div, copyright.nextSibling);

    }
    function setzero(i){
        if (i<10)
        {i="0" + i};
        return i;
    }

    show_run_time();

  </script>




<!-- 旋转魔方 -->

   
      
<style>
  /*最外层容器样式*/
  .wrap {
    width: 0px;
    height: 0px;
    /*margin: 80px;*/
    /*position: relative;*/
	     /*显示位置*/
    position: fixed;
    bottom: 120px;
    right: 240px;
    z-index: 999;
  }

  /*包裹所有容器样式*/
  .cube {
    width: 0px;
    height: 0px;
    margin: 0 auto;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    transform: rotateX(-30deg) rotateY(-80deg);
    animation: rotate linear 10s infinite;
  }

  @-webkit-keyframes rotate {
    from {
      transform: rotateX(0deg) rotateY(0deg);
    }
    to {
      transform: rotateX(360deg) rotateY(360deg);
    }
  }

  .cube div {
    position: absolute;
    width: 50px;
    height: 50px;
    opacity: 0.8;
    transition: all .4s;
  }

  /*定义所有图片样式*/
  .pic {
    width: 50px;
    height: 50px;
  }

  .cube .out_front {
    transform: rotateY(0deg) translateZ(25px);
  }

  .cube .out_back {
    transform: translateZ(-25px) rotateY(180deg);
  }

  .cube .out_left {
    transform: rotateY(-90deg) translateZ(25px);
  }

  .cube .out_right {
    transform: rotateY(90deg) translateZ(25px);
  }

  .cube .out_top {
    transform: rotateX(90deg) translateZ(25px);
  }

  .cube .out_bottom {
    transform: rotateX(-90deg) translateZ(25px);
  }

  /*定义小正方体样式*/
  .cube span {
    display: block;
    width: 25px;
    height: 25px;
    position: absolute;
    top: 12px;
    left: 12px;
  }

  .cube .in_pic {
    width: 25px;
    height:25px;
  }

  .cube .in_front {
    transform: rotateY(0deg) translateZ(12px);
  }

  .cube .in_back {
    transform: translateZ(-12px) rotateY(180deg);
  }

  .cube .in_left {
    transform: rotateY(-90deg) translateZ(12px);
  }

  .cube .in_right {
    transform: rotateY(90deg) translateZ(12px);
  }

  .cube .in_top {
    transform: rotateX(90deg) translateZ(12px);
  }

  .cube .in_bottom {
    transform: rotateX(-90deg) translateZ(12px);
  }

  /*鼠标移入后样式*/
  .cube:hover .out_front {
    transform: rotateY(0deg) translateZ(50px);
  }

  .cube:hover .out_back {
    transform: translateZ(-50px) rotateY(180deg);
  }

  .cube:hover .out_left {
    transform: rotateY(-90deg) translateZ(50px);
  }

  .cube:hover .out_right {
    transform: rotateY(90deg) translateZ(50px);
  }

  .cube:hover .out_top {
    transform: rotateX(90deg) translateZ(50px);
  }

  .cube:hover .out_bottom {
    transform: rotateX(-90deg) translateZ(50px);
  }
</style>

<div class="wrap">

		<!--包裹所有元素的容器-->
		<div class="cube">
			<!--前面图片 -->
			<div class="out_front">
			  <a onclick="back2top()">
				  <img src="http://cdn.yangchaofan.cn/BlogGifRes/20210307/lAq9mKTioPeO.png" class="pic" />
				</a>
			</div>
			<!--后面图片 -->
			<div class="out_back">
				<a onclick="back2top()">
          <img src="http://cdn.yangchaofan.cn/BlogGifRes/20210307/lAq9mKTioPeO.png" class="pic" />
        </a>
			</div>
			<!--左面图片 -->
			<div class="out_left">
        <a onclick="back2top()">
				  <img src="http://cdn.yangchaofan.cn/BlogGifRes/20210307/lAq9mKTioPeO.png" class="pic" />
				</a>
			</div>
			<!--右面图片 -->
			<div class="out_right">
				<a onclick="back2top()">
          <img src="http://cdn.yangchaofan.cn/BlogGifRes/20210307/lAq9mKTioPeO.png" class="pic" />
        </a>
			</div>
			<!--上面图片 -->
			<div class="out_top">
				<a onclick="back2top()">
          <img src="http://cdn.yangchaofan.cn/BlogGifRes/20210307/lAq9mKTioPeO.png" class="pic" />
        </a>
			</div>
			<!--下面图片 -->
			<div class="out_bottom">
				<a onclick="back2top()">
          <img src="http://cdn.yangchaofan.cn/BlogGifRes/20210307/lAq9mKTioPeO.png" class="pic" />
        </a>
			</div>

			<!--小正方体 -->
			<span class="in_front">
				<img src="https://s2.ax1x.com/2019/10/14/KptCPf.th.jpg" class="in_pic" />
			</span>
			<span class="in_back">
			     <img src="https://s2.ax1x.com/2019/10/14/KptCPf.th.jpg" class="in_pic" />
			</span>
			<span class="in_left">
				<img src="https://s2.ax1x.com/2019/10/14/KptCPf.th.jpg" class="in_pic" />
			</span>
			<span class="in_right">
				<img src="https://s2.ax1x.com/2019/10/14/KptCPf.th.jpg" class="in_pic" />
			</span>
			<span class="in_top">
				<img src="https://s2.ax1x.com/2019/10/14/KptCPf.th.jpg" class="in_pic" />
			</span>
			<span class="in_bottom">
				<img src="https://s2.ax1x.com/2019/10/14/KptCPf.th.jpg" class="in_pic" />
			</span>
		</div>

</div>

<script>
  function back2top(){
    $('html, body').animate({scrollTop: 0}, 500);
  }
</script>

   


<!-- Console 输出第三方个性化字体 -->

  <script async type="text/javascript" src="/blog/figlet/fetch.min.js"></script>
  <script type="text/javascript" src="/blog/figlet/figlet.js"></script>
  <script type="text/javascript">

      figlet.defaults({fontPath: "/figlet/fonts"});
      figlet("Welcome To Leaface", "Big Money-ne", function(err, text) {
          if (err) {
              console.log("something went wrong...");
              console.dir(err);
              return;
          }
          console.log(text);
      });
  </script>


  <!-- Console 输出自定义字体 -->
  
    <script async type="text/javascript">
        var text = "Welcome To Leaface";
        var date = '2021-06-10';
        console.log("%c " + text, "font-size:100px;color:white;border-radius:20px;height:200px; background:-webkit-linear-gradient(yellow,orange,red,green,blue,purple);text-shadow: 0 1px 0 #ccc,0 2px 0 #c9c9c9,0 3px 0 #bbb,0 4px 0 #b9b9b9,0 5px 0 #aaa,0 6px 1px rgba(0,0,0,.1),0 0 5px rgba(0,0,0,.1),0 1px 3px rgba(0,0,0,.3),0 3px 5px rgba(0,0,0,.2),0 5px 10px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.2),0 20px 20px rgba(0,0,0,.15);");
        console.info('\n' + ' %c Leafae Site %c https://www.liaofuzhan.com ' + '\n', 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;');
        console.info('\n' + ' %c Leafae QQ %c 793458585 ' + '\n', 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;');
        console.info('\n' + ' %c Leafae Wechat %c leaface ' + '\n', 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;');
       // console.log("%c Time: " + date, "font-size:100px;white:"+fcolor+";border-radius:20px;height:200px; background:-webkit-linear-gradient(yellow,orange,red,green,blue,purple);text-shadow: 0 1px 0 #ccc,0 2px 0 #c9c9c9,0 3px 0 #bbb,0 4px 0 #b9b9b9,0 5px 0 #aaa,0 6px 1px rgba(0,0,0,.1),0 0 5px rgba(0,0,0,.1),0 1px 3px rgba(0,0,0,.3),0 3px 5px rgba(0,0,0,.2),0 5px 10px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.2),0 20px 20px rgba(0,0,0,.15);  background-image: linear-gradient(to right, orangered, orange, gold, lightgreen, cyan, dodgerblue, mediumpurple, hotpink, orangered);");
       // console.log("%c .", "padding:300px 600px;line-height:10px;background:url(https://s2.ax1x.com/2019/10/17/KkoAJJ.md.png) no-repeat;");
    </script>
  


  <!-- 看板娘 -->
  
      <script async src="/live2d-widget/autoload.js"></script>
  
	<!-- leafacePlayer -->
	
	<script id="lfz" src="http://player.liaofuzhan.com/player/player.js" key=1368557075310858241></script>
	

  

  

  <!-- 代码块复制功能 -->
  <script async type="text/javascript" src="/js/src/clipboard.min.js"></script>
  <script async type="text/javascript" src="/js/src/clipboard-use.js"></script>
 

  <!--share.js-->
  <link async rel="stylesheet" href="/sharejs/css/share.min.css">
  <script async src="/sharejs/js/social-share.min.js"></script>

  <!-- 模仿知乎卡片样式链接、崩溃欺骗特效 -->
  <script async type="text/javascript" src="/js/src/linkcard.js"></script>

  <!--崩溃欺骗 放在js文件最后-->
  <!--
  <script type="text/javascript" src="/js/src/crash_cheat.js"></script>
  -->

 

<script src="/blog/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
